#include "stdafx.h"
#include <stdio.h>
struct student_type
{    int num;
     char name[10];
     int age;
     char addr[15];
}stud[3];

main()
{   
	int i;
    FILE *fp;
    if((fp=fopen("file.txt","rb"))==NULL)
    {   
		printf("can't open file\n");
		return -1;
    }

    for(i=0;i<3;i+=2)
    {   
		fseek(fp,i*sizeof(struct student_type),0);
		fread(&stud[i],sizeof(struct student_type),1,fp);
		printf("%s  %d  %d  %s\n",stud[i].name,stud[i].num,
				  stud[i].age,stud[i].addr);
    }

    fclose(fp);
	return 0;
}